package com.jiaai.web.zfp_back.system;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.exception.ServerException;
import com.jiaai.system.api.IPayManageAPI;
import com.jiaai.system.model.PayManagerVO;
import com.jiaai.util.RestResultGenerator;
import org.springframework.web.bind.annotation.*;

/**
 * class_name:PayManagerController
 * describe:TODO
 * create_user:张昉平
 * create_date:2017/12/20
 * create_date:16:27
 */
@RestController
@RequestMapping("/api/v1/admin/paymanager")
public class PayManagerController {

    @Reference
    private IPayManageAPI iPayManageAPI;

    @RequestMapping("/list")
    public Object list(@RequestParam Integer curr)throws ServerException {
        return  RestResultGenerator.genSuccessResult(iPayManageAPI.getAll(curr));
    }

    @PostMapping("/saveoredit")
    public Object saveOrEdit(@RequestBody PayManagerVO payManagerVO)throws ServerException {
        iPayManageAPI.saveOrEdit(payManagerVO);
        return  RestResultGenerator.genSuccessResult("操作成功");
    }

    @RequestMapping("/delete/{id}")
    public Object delete(@PathVariable("id") Integer id)throws ServerException {
        iPayManageAPI.delete(id);
        return  RestResultGenerator.genSuccessResult("操作成功");
    }
}
